#pragma once
#include "spisok.h"
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<string.h>


typedef void *Pointer;
typedef unsigned (*HashFunction)(char *key);
typedef void (*Destructor)(Pointer);

struct Note
{
        char key[32];
        Pointer value;
        unsigned int h;
};

typedef struct HashTable {
    size_t size;
    SList **table;
    HashFunction hashfunc;
    Destructor dtor;
} HashTable;

unsigned jenkins_one_at_a_time_hash(char *key);
void ht_init(HashTable *ht, size_t size, HashFunction hf, Destructor dtor);
Pointer ht_get(HashTable *ht, char *key);
void ht_set(HashTable *ht, char *key, Pointer data);
int ht_has(HashTable *ht, char *key);
void ht_destroy(HashTable *ht);

void ht_traverse(HashTable *ht, void (*func)(char *key, Pointer data));

